<?php

namespace Ibw\JobeetBundle\Form;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Ibw\JobeetBundle\Entity\Job;

class JobType extends AbstractType {

    public function buildForm(FormBuilderInterface $builder, array $options) {
        $builder
                ->add('type', 'choice', array('choices' => Job::getTypes(), 'expanded' => true ))
                ->add('category')
                ->add('company')
                ->add('logo', null, array('label' => 'Company logo'))->add('url')
                ->add('position')
                ->add('location')
                ->add('description')
                ->add('howToApply', null, array('label' => 'How to apply?'))
                //->add('token')
                ->add('is_public', null, array('label' => 'Public?'))
                ->add('email')
                ->add('file', 'file', array('label' => 'Company logo', 'required' => false))
        ;
    }

    public function setDefaultOptions(OptionsResolverInterface $resolver) {
        $resolver->setDefaults(array(
            'data_class' => 'Ibw\JobeetBundle\Entity\Job'
        ));
    }

    public function getName() {
        return 'job';
    }

}
